/*
 * Winamp.h
 *
 * Copyright (c) 2009-2011 [BRN] aka. SWW13.
 *
 * This file is part of [BRN]Lib.
 *
 * [BRN]Lib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * [BRN]Lib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with [BRN]Lib.  If not, see <http ://www.gnu.org/licenses/>.
 */

#pragma once
#include <iostream>
#include <windows.h>

// WM_COMMAND - Commands to send to Winamp Client.
#define WINAMP_START 40045
#define WINAMP_PLAY_OR_PAUSE 40046
#define WINAMP_NEXT_TRACK 40048
#define WINAMP_PREVIOUS_TRACK  40044
#define WINAMP_CLOSE 40001
#define WINAMP_STOP 40047
#define WINAMP_RAISE_VOLUME 40058
#define WINAMP_LOWER_VOLUME 40059
#define WINAMP_TOGGLE_REPEAT 40022
#define WINAMP_TOGGLE_SHUFFLE 40023
#define WINAMP_FAST_FORWARD 40148
#define WINAMP_FAST_REWIND 40144
#define WINAMP_WINDOW_HANDLE "Winamp v1.x"

// WM_USER
#define WINAMP_CUSTOM_VOLUME 122
#define WINAMP_ISPLAYING 104 //Return: 0 = Stop | 1 = Play | 3 = Pause
#define WINAMP_GET_OUTPUTTIME 105 //Parameter: 0 = Current | 1 = Total
#define WINAMP_GET_SHUFFLE 250
#define WINAMP_GET_REPEAT 251
#define WINAMP_CB_MISC 603
#define WINAMP_CB_MISC_VOLUME 1 // volume/pan

namespace BRNlib
{
	namespace Core
	{
		//http://www.codeproject.com/KB/stl/Winamp_Controller.aspx
		class Winamp
		{
		public:
			static void PlayOrPause();
			static void Next();
			static void Previous();
			static void Start();
			static void Stop();
			static void Close();
			static void VolumeUp();
			static void VolumeDown();
			static void ToggleRepeat();
			static void ToggleShuffle();
			static void SetVolume(int Volume);
			static void FastForward();
			static void FastRewind();

			static int GetCurrentTime();
			static int GetTotalTime();
			static int GetPlayedPercent();
			static bool GetShuffle();
			static bool GetRepeat();
			static int GetPlayState();
			static int GetVolume();
			static char *CurrentTrack();

			static void WCommand(int command);
			static int UCommand(int command, int input);
			static HWND WinampHandle();
		
		private:
			static char itsCurrentTrack[2048];
			static char *p;
		};
	}
}